#include "MicroBit.h"
#include "neopixel.h"

extern MicroBit uBit;

int length = 8;
int brightness = 32;
int c = 1;
ManagedBuffer b(length * 3);

void neopixel_set_length(int l)
{
    length = l;
    b = ManagedBuffer(length * 3);
}

void neopixel_set_green()
{
    int c = 0;
    b.fill(0);
    for (int i = 0; i < length * 3; i += 3)
        b[i + c] = brightness;
    neopixel_send_buffer(uBit.io.P1, b);
}

void neopixel_set_red()
{
    int c = 1;
    b.fill(0);
    for (int i = 0; i < length * 3; i += 3)
        b[i + c] = brightness;
    neopixel_send_buffer(uBit.io.P1, b);
}

void neopixel_set_blue()
{
    int c = 2;
    b.fill(0);
    for (int i = 0; i < length * 3; i += 3)
        b[i + c] = brightness;
    neopixel_send_buffer(uBit.io.P1, b);
}